// default package
// Generated 28 Jul, 2014 8:04:07 PM by Hibernate Tools 3.4.0.CR1
package com.galaxy.bean;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * SalesruleCoupon generated by hbm2java
 */
@Entity
@Table(name = "salesrule_coupon", catalog = "magento", uniqueConstraints = {
		@UniqueConstraint(columnNames = "code"),
		@UniqueConstraint(columnNames = { "rule_id", "is_primary" }) })
public class SalesruleCoupon implements java.io.Serializable {
	private static final long serialVersionUID = 121323L;

	private Integer couponId;
	private Salesrule salesrule;
	private String code;
	private Integer usageLimit;
	private Integer usagePerCustomer;
	private int timesUsed;
	private Date expirationDate;
	private Short isPrimary;
	private Set salesruleCouponUsages = new HashSet(0);

	public SalesruleCoupon() {
	}

	public SalesruleCoupon(Salesrule salesrule, int timesUsed) {
		this.salesrule = salesrule;
		this.timesUsed = timesUsed;
	}

	public SalesruleCoupon(Salesrule salesrule, String code,
			Integer usageLimit, Integer usagePerCustomer, int timesUsed,
			Date expirationDate, Short isPrimary, Set salesruleCouponUsages) {
		this.salesrule = salesrule;
		this.code = code;
		this.usageLimit = usageLimit;
		this.usagePerCustomer = usagePerCustomer;
		this.timesUsed = timesUsed;
		this.expirationDate = expirationDate;
		this.isPrimary = isPrimary;
		this.salesruleCouponUsages = salesruleCouponUsages;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "coupon_id", unique = true, nullable = false)
	public Integer getCouponId() {
		return this.couponId;
	}

	public void setCouponId(Integer couponId) {
		this.couponId = couponId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "rule_id", nullable = false)
	public Salesrule getSalesrule() {
		return this.salesrule;
	}

	public void setSalesrule(Salesrule salesrule) {
		this.salesrule = salesrule;
	}

	@Column(name = "code", unique = true)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "usage_limit")
	public Integer getUsageLimit() {
		return this.usageLimit;
	}

	public void setUsageLimit(Integer usageLimit) {
		this.usageLimit = usageLimit;
	}

	@Column(name = "usage_per_customer")
	public Integer getUsagePerCustomer() {
		return this.usagePerCustomer;
	}

	public void setUsagePerCustomer(Integer usagePerCustomer) {
		this.usagePerCustomer = usagePerCustomer;
	}

	@Column(name = "times_used", nullable = false)
	public int getTimesUsed() {
		return this.timesUsed;
	}

	public void setTimesUsed(int timesUsed) {
		this.timesUsed = timesUsed;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "expiration_date", length = 19)
	public Date getExpirationDate() {
		return this.expirationDate;
	}

	public void setExpirationDate(Date expirationDate) {
		this.expirationDate = expirationDate;
	}

	@Column(name = "is_primary")
	public Short getIsPrimary() {
		return this.isPrimary;
	}

	public void setIsPrimary(Short isPrimary) {
		this.isPrimary = isPrimary;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "salesruleCoupon")
	public Set getSalesruleCouponUsages() {
		return this.salesruleCouponUsages;
	}

	public void setSalesruleCouponUsages(Set salesruleCouponUsages) {
		this.salesruleCouponUsages = salesruleCouponUsages;
	}

}
